package com.zjhn.ds.controller.app;

import com.alibaba.fastjson.JSON;
import com.zjhn.ds.common.BizResult;
import com.zjhn.ds.domain.dto.pad.ControlInfoDto;
import com.zjhn.ds.domain.dto.pad.UserInfoDto;
import com.zjhn.ds.param.ControlInfoParam;
import com.zjhn.ds.service.HomePageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @BelongsProject: ds_jlw
 * @BelongsPackage: com.zjhn.ds.controller.app.pad
 * @Author: sxt
 * @CreateTime: 2023-09-20  15:33
 * @Description: pad端首页接口
 * @Version: 1.0
 */
@Slf4j
@RestController
@RequestMapping("/jlw/home")
@Api(tags = "移动端/pad端 首页接口")
public class HomePageController {

    @Resource
    private HomePageService homePageService;

    @ApiOperation("登录后获取用户数据")
    @GetMapping("/getUserInfo")
    public BizResult<UserInfoDto> getUserInfo() {
        log.info("====[INFO]========HomePageController====getUserInfo");
        return homePageService.getUserInfo();
    }

    @ApiOperation("pad首页控制台数据")
    @PostMapping("/controlInfo")
    public BizResult<ControlInfoDto> controlInfo(@RequestBody @Valid ControlInfoParam param) {
        log.info("====[INFO]========HomePageController====controlInfo param:{}", JSON.toJSONString(param));
        return homePageService.controlInfo(param);
    }


}
